<template>
  <div>
    <input type="text" v-model="user.name">
    <input type="text" v-model="user.age">
  </div>
</template>

<script>
export default {

  data() {
    return {
      user: {
        name : '',
        age : ''
      }
    };
  },
  watch: {
    user : {
      // immediate:true, 页面加载时立即执行一次
      deep :true,
      handler(newVal,oldVal) {
        console.log(newVal.name);
        console.log(this.user);
      }
    }
  }

};
</script>

<style lang="scss" scoped>

</style>